Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
How to convert React.FC syntax to const x = () => {}?

I have this code below that I tried to convert its syntax (I am using TypeScript, React) from the syntax below to const x = () => {} form.

const EntryDetails: FC<{ entry: Entry }> = ({ entry }) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};

Somehow it crashed my code so I assumed I did not convert it properly. Can someone help me get it converted?

My attempt was as below:

const EntryDetails = (entry: Entry) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};

and I also tried

const EntryDetails = ({entry}: Entry) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

your function component must look like this...

const EntryDetail: FC<PropsFromYourTypesSheet> = (props) => {
  your Code
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!